# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=python-pytest-asyncio
pkgver=0.21.0
_commit=75dcceafcea94b8c286b8cba1b00ddec2593261f
pkgrel=3
pkgdesc="Pytest support for asyncio."
arch=('any')
license=('Apache')
url="https://github.com/pytest-dev/pytest-asyncio/"
depends=('python-pytest')
makedepends=('git' 'python-build' 'python-installer' 'python-setuptools-scm' 'python-wheel')
checkdepends=('python-flaky' 'python-hypothesis' 'python-pytest-trio')
source=("git+https://github.com/pytest-dev/pytest-asyncio.git#commit=$_commit")
sha512sums=('SKIP')

build() {
  cd pytest-asyncio
  python -m build -wn
}

check() {
  # Hack entry points by installing it

  cd pytest-asyncio
  python -m installer --destdir=tmp_install dist/*.whl
  local site_packages=$(python -c "import site; print(site.getsitepackages()[0])")
  PYTHONPATH="$PWD/tmp_install/$site_packages:$PYTHONPATH:$PWD/tests" pytest
}

package() {
  cd pytest-asyncio
  python -m installer --destdir="$pkgdir" dist/*.whl
}
